#pragma once

#include <IL/il.h>
#include <gl/freeglut.h>
#include <string>

#include "Recurso.h"

class Textura : public Recurso
{
private:
	GLuint idTextura;
	ILuint ilID;

	int ancho,alto;
	
	int anchoReal, altoReal;

	bool alpha;
public:
	Textura(std::string & ruta, bool alpha = false);

	void cargar(std::string & ruta);
	void bind(void);

	float getAlto(){return (float)alto;};
	float getAncho(){return (float)ancho;};
	float getUnidadAlto(){return (float)alto/(float)altoReal;}
	float getUnidadAncho(){return (float)ancho/(float)anchoReal;}

	int getIlID(){return ilID;};

	bool isAlpha(){return alpha;};
	unsigned int *getPixels(int x, int y);

private:
	int getNextPowOfTwo(int n);
public:
	~Textura(void);
};
